<?php

/**
 * @author Terry & 千里孤坟
 * @copyright 2009
 */

class CureSkill {
	public function __construct() {
		$this->id = -1;
		$this->name = "基类";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 0;
		$this->ap = 0;
		
		$this->pwr = 140;			//基本回复值		
		$this->plus = 0;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 1;		//全体回复时实际人数
					
	}

	public function pre_cure($sk,$a,$b) {

	}

	public function cure_desc($a,$b) {
		$_SESSION['show'] .= $a->name."对".$b->name."发动".$this->name."<br>";
	}

	public function checkex($a) {
		if(isset($this->excid) && in_array($a->cid,$this->excid)) {
			$this->name = "<font color=blue>EX".$this->name."</font>";
			$this->ex = 1;
			$this->exskset();
		}
	}

	public function exskset() {
		return 1;
	}
}

class SingleCureSkill extends CureSkill {

	public function __construct() {
		$this->id = -1;
		$this->name = "单体恢复基类";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 0;
		$this->ap = 0;
		
		$this->pwr = 140;			//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}

	public function start($a,$b,$atkid,$defid,$defer) {
		
		$this->checkex($a[$atkid]);
		$this->pre_cure($this,$a[$atkid],$defer);
		CalHelper::cost_cal($a[$atkid],$this);
		$sk = clone $this;
		$loversk = NULL;
	
		if($defer->hp <= 0 || $defer->escaping == 1) return 0;
		CalHelper::judgepoint($a[$atkid],$defer,'CURE');
		if($defer->defskill_status[24]->on == 1 && !$this->sptcure) {
			$_SESSION['show'] .= $defer->name."的魔法反射镜发动，恢复无效<br>";
			$defer->defskill_status[24]->cancel($defer);
			return 0;
		}
		if($defer->before_status[55]->on == 1) {
			$_SESSION['show'] .= $defer->name."的魔界の調べ效果发动，恢复无效<br>";
			return 0;
		}
		if($defer->hp <= round($defer->mxhp/3)) $loversk = 1;
		/** 对b的防御性技能影响状态数组遍历 **/
		foreach($defer->defskill_status as $dss) {
			if($dss->on == 1)
				$dss->action($a[$atkid],$defer,$sk);
		}
		$_SESSION['show'] .= "<p>";
		$this->cure_desc($a[$atkid],$defer);
		if(CalHelper::ifgroupskill($a[$atkid]) == 6 && $loversk == 1) {
			$_SESSION['show'] .= "女神の慈愛发动，对".$defer->name."恢复效果提升。<br>";
			$sk->plus *= 1.25;
		}
		$sk->action($a[$atkid],$defer);
	}
	
	public function action($a,$b) {

	}

}

class AllCureSkill extends CureSkill {

	public function __construct() {
		$this->id = -1;
		$this->name = "全体恢复基类";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 0;
		$this->ap = 0;
		
		$this->pwr = 140;			//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 1;		//全体回复时实际人数
					
	}

	public function start($a,$b,$atkid,$defid,$defer) {
		
		$this->checkex($a[$atkid]);
		$this->tgtnum = CalHelper::live_count($a);
		$this->pre_cure($this,$a[$atkid],$defer);
		CalHelper::cost_cal($a[$atkid],$this);
		CalHelper::judgepoint($a[$atkid],$defer,'CURE');
		$minhp = 0;
		$minhper = '';
		
		foreach($a as $d) {
			if($d->hp <= 0) continue;
			if($d->defskill_status[24]->on == 1 && !$this->sptcure) {
				$_SESSION['show'] .= $d->name."的魔法反射镜发动，恢复无效<br>";
				$d->defskill_status[24]->cancel($d);
				continue;
			}
			if($d->before_status[55]->on == 1) {
				$_SESSION['show'] .= $d->name."的魔界の調べ效果发动，恢复无效<br>";
				continue;
			}
			$sk = clone $this;
			if(CalHelper::ifgroupskill($a[$atkid]) == 6 && $d->hp <= round($d->mxhp/3)) {
				$_SESSION['show'] .= "女神の慈愛发动，对".$d->name."恢复效果提升<br>";
				$sk->plus *= 1.25;
			}
			if($a[$atkid]->before_status[60]->on == 1 && $a[$atkid] != $d) continue; //猜疑时跳过他人
			/** 对b的防御性技能影响状态数组遍历 **/
			foreach($d->defskill_status as $dss) {
				if($dss->on == 1)
					$dss->action($a[$atkid],$d,$sk);
			}
			$_SESSION['show'] .= "<p>";
			$this->cure_desc($a[$atkid],$d);
			$sk->action($a[$atkid],$d);
		}
	}
	
	public function action($a,$b) {

	}

}

class ReliveCureSkill extends CureSkill {

	public function __construct() {
		$this->id = -1;
		$this->name = "复活技能基类";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 0;
		$this->ap = 0;
		
		$this->pwr = 140;			//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}

	public function start($a,$b,$atkid,$defid,$defer) {
		
		$this->checkex($a[$atkid]);
		CalHelper::cost_cal($a[$atkid],$this);
		CalHelper::judgepoint($a[$atkid],$defer,'CURE');
		$sk = clone $this;
	
		if($defer->hp > 0) return 0;
		if($defer->defskill_status[24]->on == 1 && !$this->sptcure) {
			$_SESSION['show'] .= $defer->name."的魔法反射镜发动，复活无效<br>";
			$defer->defskill_status[24]->cancel($defer);
			return 0;
		}
		$_SESSION['show'] .= "<p>";
		$this->cure_desc($a[$atkid],$defer);
		if(CalHelper::ifgroupskill($a[$atkid]) == 6 && $defer->hp <= round($defer->mxhp/3)) {
			$_SESSION['show'] .= "女神の慈愛发动，对".$defer->name."恢复效果提升。<br>";
			//StatusHelper::vit_up_5($defer);
			$sk->plus *= 1.25;
		}
		$sk->action($a[$atkid],$defer);
	}
	
}

class DeiA extends SingleCureSkill {

	public function __construct() {
		$this->id = 330;
		$this->name = "ディア";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 60;
		$this->ap = 4;
		
		$this->pwr = 140;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}

	public function action($a,$b) {
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
	}
}

class MeDeiA extends AllCureSkill {
	
	public function __construct() {
		$this->id = 331;
		$this->name = "メディア";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 80;
		$this->ap = 6;
		
		$this->pwr = 140;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 1;		//全体回复时实际人数
					
	}
	
	public function action($a,$b) {
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
					
	}
}

class DeiLama extends SingleCureSkill {

	public function __construct() {
		$this->id = 332;
		$this->name = "ディアラマ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 80;
		$this->ap = 7;
		
		$this->pwr = 280;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
	}
	
	public function action($a,$b) {
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
	}
}

class MeDeiLama extends AllCureSkill {

	public function __construct() {
		$this->id = 333;
		$this->name = "メディラマ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 100;
		$this->ap = 8;
		
		$this->pwr = 280;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 1;		//全体回复时实际人数
	}
	
	public function action($a,$b) {
		if($a->cid == 24) {
			$_SESSION['show'] .= "寥寥的青烟，淡淡的魔香...<br>";
			CalHelper::cgdisplay('sing_mcure.jpg');
		}
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
					
	}
}

class DeiLaHang extends SingleCureSkill {

	public function __construct() {
		$this->id = 334;
		$this->name = "ディアラハン";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 110;
		$this->ap = 9;
		
		$this->pwr = 430;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
	}
	
	public function action($a,$b) {
		if($a->cid == 36) {
			CalHelper::spec_talk($this,1,"哼，吃一个盖亚斯馒头");
			CalHelper::cgdisplay('lonelywave_3.jpg');
		} elseif($a->cid == 2) {
			CalHelper::spec_talk($this,2,"宁静的微风，请赐予治愈的祝福");
		}
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
	}
}

class MeDeiLaHang extends AllCureSkill {

	public function __construct() {
		$this->id = 335;
		$this->name = "メディアラハン";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 140;
		$this->ap = 11;
		
		$this->pwr = 430;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 1;		//全体回复时实际人数
		$this->excid = array(14,49);
	}
	
	public function exskset() {
		$this->sp = 140;
		$this->ap = 11;
	}
	
	//行动函数
	public function action($a,$b) {
		if($a->cid == 43) {
			$_SESSION['show'] .= "时机还未来到……你等须尽力通过救赎者的试炼，终点之前，不可倒下……<br>";
			CalHelper::cgdisplay('lili_baozi.jpg');
		}
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
					
	}
}

class LifeSpring extends SingleCureSkill {

	public function __construct() {
		$this->id = 336;
		$this->name = "生命の泉";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 150;
		$this->ap = 12;
		
		$this->pwr = 580;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}
	
	public function action($a,$b) {
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";

		//异常恢复
		StatusHelper::cure_allspt($b);
	}
}

class Messiah extends AllCureSkill {
	
	public function __construct() {
		$this->id = 337;
		$this->name = "メシアライザー";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 200;
		$this->ap = 14;
		
		$this->pwr = 800;		//基本回复值		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 1;		//全体回复时实际人数
		$this->godds = 0;
		$this->excid = array(1);
	}
	
	public function exskset() {
		$this->sp = 180;
		$this->ap = 13;
	}

	public function action($a,$b) {
		if($this->ex == 1) {
			CalHelper::cgdisplay('teaplum_10.jpg');
			$_SESSION['show'] .= "救济之光，普照众生！<br>";
		}
		if($a->cid == 43) {
			$_SESSION['show'] .= "时机还未来到……你等须尽力通过救赎者的试炼，终点之前，不可倒下……<br>";
			CalHelper::cgdisplay('lili_baozi.jpg');
		} elseif($a->cid == 2) {
			$_SESSION['show'] .= "好好看着，为名“守护”的力量<br>";
		}
		$hp = CalHelper::cure_cal($a,$b,$this);
		
		$b->hp += $hp;
		if($b->hp > $b->mxhp) $b->hp = $b->mxhp;				
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";

		//异常恢复
		StatusHelper::cure_allspt($b);
	}
}

class RiKaaMu extends ReliveCureSkill {

	public function __construct() {
		$this->id = 338;
		$this->name = "リカーム";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 80;
		$this->ap = 6;
		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}
	
	public function action($a,$b) {
		if($a->cid == 43) {
			$_SESSION['show'] .= $a->name."翻开《现代咒语辞典》，一字一句咏唱起来：<br>";
			$_SESSION['show'] .= "静静流逝的所有一切，这个世界没有终结……<br>";
			$_SESSION['show'] .= "安息吧，".$b->name."，你的灵魂，将会延续……<br>";
			$_SESSION['show'] .= "在这个地方与你初次相逢，直至永远……<br>";
			$_SESSION['show'] .= "我走过那片阴暗的草坪，我不会感到恐惧,因为你的灵魂与我同在……<br>";
			$_SESSION['show'] .= "这真的是复活咒？<br>";
			CalHelper::cgdisplay('lili_rk.jpg');
		}
		$b->hp = round($b->mxhp * 0.11);
		StatusHelper::resetall($b);
		//倒地中
		$b->before_status[0]->on = 1;
		$b->defskill_status[0]->on = 1;
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
					
	}
}


class SamRiKaaMu extends ReliveCureSkill {

	
	public function __construct() {
		$this->id = 339;
		$this->name = "サマリカーム";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 100;
		$this->ap = 8;
		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}
	
	public function action($a,$b) {
		$b->hp = round($b->mxhp * 0.3);
		StatusHelper::resetall($b);
		//倒地中
		$b->before_status[0]->on = 1;
		$b->defskill_status[0]->on = 1;
				
		$_SESSION['result'] .= "回复量：".$hp."<br>";
					
	}
}

class RiKaaMuDora extends ReliveCureSkill {

	public function __construct() {
		$this->id = 340;
		$this->name = "リカームドラ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 100;
		$this->ap = 10;
		
		$this->plus = 1;		//附加回复率
		$this->bonus = 0;		//附加回复值			
		
		$this->tgtnum = 0;		//全体回复时实际人数
					
	}
	
	public function action($a,$b) {
		$b->hp = round($b->mxhp * 0.5);
		$t = round($a->mxhp * 0.11);
		$a->hp = ($a->hp > $t) ? $t : $a->hp;
		
		StatusHelper::resetall($b);
		//倒地中
		$b->before_status[0]->on = 1;
		$b->defskill_status[0]->on = 1;
		$_SESSION['result'] .= "回复量：".$b->mxhp."<br>";
	}
}

class CureLure extends SingleCureSkill {

	public function __construct() {
		$this->id = 341;
		$this->name = "チャームディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,26);
	}
}

class CurePara extends SingleCureSkill {

	public function __construct() {
		$this->id = 342;
		$this->name = "パララディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,23);
	}
}

class CurePoison extends SingleCureSkill {

	public function __construct() {
		$this->id = 343;
		$this->name = "ポズムディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,20);
	}
}

class CureClose extends SingleCureSkill {

	public function __construct() {
		$this->id = 344;
		$this->name = "クロスディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 0;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,22);
	}
}

class CureConfuse extends SingleCureSkill {

	public function __construct() {
		$this->id = 345;
		$this->name = "エイジディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,28);
	}
}

class CureTerror extends SingleCureSkill {

	public function __construct() {
		$this->id = 346;
		$this->name = "パトラ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,27);
	}
}

class CureHigh extends SingleCureSkill {

	public function __construct() {
		$this->id = 347;
		$this->name = "ブルトディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,25);
	}
}

class CureOld extends SingleCureSkill {

	public function __construct() {
		$this->id = 348;
		$this->name = "シシリディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 30;
		$this->ap = 3;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_abn($a,$b,$this,24);
	}
}

class CureMental extends SingleCureSkill {

	public function __construct() {
		$this->id = 349;
		$this->name = "メパトラ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 60;
		$this->ap = 4;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_mentalspt($b);
	}
}

class CureBody extends SingleCureSkill {

	public function __construct() {
		$this->id = 350;
		$this->name = "リパトラ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 60;
		$this->ap = 4;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_bodyspt($b);
	}
}

class CureAllMental extends AllCureSkill {

	public function __construct() {
		$this->id = 351;
		$this->name = "コトルムディ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 80;
		$this->ap = 4;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_mentalspt($b);
	}
}

class CureAllBody extends AllCureSkill {

	public function __construct() {
		$this->id = 352;
		$this->name = "エナジーシャワー";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 80;
		$this->ap = 4;
	}
	
	public function action($a,$b) {
		StatusHelper::cure_bodyspt($b);
	}
}

class LovePray extends SingleCureSkill {

	public function __construct() {
		$this->id = 353;
		$this->name = "慈愛の祈り";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 80;
		$this->ap = 5;
	}
	
	//行动函数
	public function action($a,$b) {
		StatusHelper::cure_allspt($b);
	}
}

class Amurita extends AllCureSkill {
	
	public function __construct() {
		$this->id = 354;
		$this->name = "アムリタ";			//技能名称
		$this->type = 12;				//组别		
	
		$this->hp = 0;			//消耗
		$this->sp = 100;
		$this->ap = 7;
	}

	public function action($a,$b) {
		StatusHelper::cure_allspt($b);
	}
}


?>
